using OneCaps.Core.Entity;
using OneCaps.Core.Enum;

namespace OneCaps.Core.Interfaces
{
    /// <summary>
    /// 车位仓库接口
    /// </summary>
    public interface IParkingSpaceRepository : IRepository<ParkingSpace, int>
    {
        /// <summary>
        /// 根据车位编号获取车位
        /// </summary>
        Task<ParkingSpace?> GetBySpaceNumberAsync(string spaceNumber);

        /// <summary>
        /// 检查车位编号是否存在
        /// </summary>
        Task<bool> ExistsBySpaceNumberAsync(string spaceNumber);

        /// <summary>
        /// 获取可用车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetAvailableSpacesAsync();

        /// <summary>
        /// 根据车位类型获取车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetBySpaceTypeAsync(ParkingSpaceType spaceType);

        /// <summary>
        /// 根据车位状态获取车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetByStatusAsync(ParkingSpaceStatus status);

        /// <summary>
        /// 获取指定类型的可用车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetAvailableSpacesByTypeAsync(ParkingSpaceType spaceType);

        /// <summary>
        /// 获取VIP车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetVipSpacesAsync();

        /// <summary>
        /// 获取充电桩车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetChargingSpacesAsync();

        /// <summary>
        /// 获取无障碍车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetAccessibleSpacesAsync();

        /// <summary>
        /// 根据区域获取车位
        /// </summary>
        Task<IEnumerable<ParkingSpace>> GetByAreaAsync(string area);

        /// <summary>
        /// 获取车位统计信息
        /// </summary>
        Task<ParkingSpaceStatistics> GetStatisticsAsync();
    }

    /// <summary>
    /// 车位统计信息
    /// </summary>
    public class ParkingSpaceStatistics
    {
        public int TotalSpaces { get; set; }
        public int AvailableSpaces { get; set; }
        public int OccupiedSpaces { get; set; }
        public int MaintenanceSpaces { get; set; }
        public Dictionary<ParkingSpaceType, int> SpacesByType { get; set; } = new();
        public Dictionary<ParkingSpaceStatus, int> SpacesByStatus { get; set; } = new();
        public Dictionary<string, int> SpacesByArea { get; set; } = new();
    }
} 